package org.com.yz.common.constant;

import java.io.File;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description: 常量类
 * @author fanjj
 * @date 2018-07-05
 * @version V1.0
 */
public class PayConstant {


	public static final String RETURN_PARAM_RETCODE = "retCode";
	public static final String RETURN_PARAM_RETMSG = "retMsg";
	public static final String RESULT_PARAM_RESCODE = "resCode";
	public static final String RESULT_PARAM_ERRCODE = "errCode";
	public static final String RESULT_PARAM_ERRCODEDES = "errCodeDes";
	public static final String RESULT_PARAM_SIGN = "sign";

	public static final String RETURN_VALUE_SUCCESS = "SUCCESS";
	public static final String RETURN_VALUE_FAIL = "FAIL";

	public static final String RETURN_ALIPAY_VALUE_SUCCESS = "success";
	public static final String RETURN_ALIPAY_VALUE_FAIL = "fail";

	/**
	 * 账户类型
	 */
	public static final String DEPOSIT_DEPOSITORY = "depository";//存管户
	public static final String DEPOSIT_PREPAY = "prepay";//准备金
	public static final String DEPOSIT_PREPAY2 = "prepay2";//准备金2
	public static final String DEPOSIT_ONWAY = "onway";//在途
	public static final String DEPOSIT_ONWAY2 = "onway2";//在途2
	public static final String DEPOSIT_PROFIT = "profit";//分润
	public static final String DEPOSIT_ASSURANCE = "assurance";//担保金
	public static final String DEPOSIT_MCHSUB = "mchsub";//子商户
	public static final String DEPOSIT_SUPPLIER = "supplier";//供应商子账户
	public static final String DEPOSIT_SUPPLIER_ASSURANCE = "supplier_assure";//供应商待结算子账户


	/**
	 * 分账类型
	 */
	public static final String DEPOSIT_EVENT_PAY = "pay";//支付
	public static final String DEPOSIT_EVENT_REFUND = "refund";//退款
	public static final String DEPOSIT_EVENT_TRANSFER = "transfer";//转账
	public static final String DEPOSIT_EVENT_SUBSIDY = "subsidy";//补贴
	public static final String DEPOSIT_EVENT_FINE = "fine";//罚款
	public static final String DEPOSIT_EVENT_CONSUME = "consume";//余额消费
	public static final String DEPOSIT_EVENT_AWARD = "award";//奖励
	public static final String DEPOSIT_EVENT_SUPPLEMENT = "supplement";//补账  redpacket 红包  coupon 优惠券
	public static final String DEPOSIT_EVENT_REDPACKET = "redpacket";//红包
	public static final String DEPOSIT_EVENT_COUPON = "coupon";//优惠券


	/**
	 * 事务类型
	 */
	public static final String DEPOSIT_TRAN_WITHDRAW = "withdraw";//提现
	public static final String DEPOSIT_TRAN_WITHDRAW_REFUND = "withdraw_refund";//提现退款
	public static final String DEPOSIT_TRAN_PAYMENT = "payment";//支付通道到账
	public static final String DEPOSIT_TRAN_EX_PAYMENT = "expayment";//超额提现到账
	public static final String DEPOSIT_TRAN_EX_RECONCILIATION = "reconciliation";//平账
	public static final String DEPOSIT_TRAN_EX_BALANCE = "balance";//结算


	/**
	 * 代付类型
	 */
	public static final String DEPOSIT_WITHDRAWTYPE_YM = "RPAYM";//收付直通车
	public static final String DEPOSIT_WITHDRAWTYPE_HOH = "HOH";//银企直联
	public static final String DEPOSIT_WITHDRAWTYPE_SUPER = "SUPER";//超级网银

	/**
	 * 错误码、错误描述
	 */
	public static final String RETURN_DEPOSIT_MUST_NULL="101";
	public static final String RETURN_DEPOSIT_MUST_NULLS="必输参数不能为空";
	public static final String RETURN_DEPOSIT_SIGN_FAIL="102";
	public static final String RETURN_DEPOSIT_SIGN_FAILS="签名验证失败";
	public static final String RETURN_DEPOSIT_BIZTYPE_NULL="103";
	public static final String RETURN_DEPOSIT_BIZTYPE_NULLS="bize_type无效";
	public static final String RETURN_DEPOSIT_ONT_ONLYS="104";
	public static final String RETURN_DEPOSIT_ONT_ONLY="外部追踪号无效";


	public static final String RETURN_DEPOSIT_OUTNO_ERROR="202";
	public static final String RETURN_DEPOSIT_OUTNO_ERRORS="外部子商户号非法";
	public static final String RETURN_DEPOSIT_MCHSUBNO_NULL="203";
	public static final String RETURN_DEPOSIT_MCHSUBNO_NULLS="子商户账号不存在";
	public static final String  RETURN_DEPOSIT_MCHNO_NULL="204";
	public static final String  RETURN_DEPOSIT_MCHNO_NULLS="商户号不存在";
	public static final String  RETURN_DEPOSIT_MCHNO_REPEAT="205";
    public static final String  RETURN_DEPOSIT_MCHNO_REPEATS="外部子商户号重复";
    public static final String  RETURN_DEPOSIT_DISPATCH_ERROR="206";
    public static final String  RETURN_DEPOSIT_DISPATCH_ERRORS="分账失败";
    public static final String  RETURN_DEPOSIT_DISPATCH_DIFTRAN="207";
    public static final String  RETURN_DEPOSIT_DISPATCH_DIFTRANS="存在不同交易";
	public static final String  RETURN_DEPOSIT_DISPATCH_REFERROR="208";
	public static final String  RETURN_DEPOSIT_DISPATCH_REFERRORS="退款对应的交易不存在，请查证";



	public static final String RETURN_DEPOSIT_CARD_NULL="301";
	public static final String RETURN_DEPOSIT_CARD_NULLS="银行卡信息不存在";
	public static final String RETURN_DEPOSIT_CARD_ERROR="302";
	public static final String RETURN_DEPOSIT_CARD_ERRORS="银行卡信息认证失败";
	public static final String RETURN_DEPOSIT_CARD_EXIT="303";
	public static final String RETURN_DEPOSIT_CARD_EXITS="子商户绑定的银行卡信息重复";
	public static final String RETURN_DEPOSIT_CARD_UNUSE="304";
	public static final String RETURN_DEPOSIT_CARDNO_UNUSE="银行卡已解绑";
	public static final String RETURN_DEPOSIT_ORDER_NO_EXIST="305";
	public static final String RETURN_DEPOSIT_ORDER_NO_EXISTS="订单号重复，请勿重复提交";
	public static final String RETURN_DEPOSIT_NOSTRO_ERROR="306";
	public static final String RETURN_DEPOSIT_NOSTRO_ERRORS="往账金额不正确";
	public static final String RETURN_DEPOSIT_LINKNAME_ERROR="307";
	public static final String RETURN_DEPOSIT_LINKNAME_ERRORS="户名与账户联系人不一致";

	public static final String RETURN_DEPOSIT_ACCNTTYPE_ERROR="307";
	public static final String RETURN_DEPOSIT_ACCNTTYPE_ERRORS="对私绑卡不可使用该接口";

	public static final String RETURN_DEPOSIT_BACTH_CREATE_ACCNT_NUM_INVALID="401";
	public static final String RETURN_DEPOSIT_BACTH_CREATE_ACCNT_NUM_INVALIDS="单次批量开设子商户数目非法";
	/*public static final String RETURN_DEPOSIT_BACTH_CREATE_ACCNT_FAIL="402";
	public static final String RETURN_DEPOSIT_BACTH_CREATE_ACCNT_FAILS="批量开设子商户失败";
	public static final String RETURN_DEPOSIT_NUM_INVALID="403";
	public static final String RETURN_DEPOSIT_NUM_INVALIDS="数目非法";*/
	public static final String RETURN_DEPOSIT_WITHDRAW_FAIL="402";
	public static final String RETURN_DEPOSIT_WITHDRAW_FAILS="提现失败";
	public static final String RETURN_DEPOSIT_BALANCE_FAIL="403";
	public static final String RETURN_DEPOSIT_BALANCE_FAILS="付款账号不存在";
	public static final String RETURN_DEPOSIT_BANK_FAIL="404";
	public static final String RETURN_DEPOSIT_BANK_FAILS="余额查询超时";
	public static final String RETURN_DEPOSIT_WITHDRAWTYPE_ERROR="405";
	public static final String RETURN_DEPOSIT_WITHDRAWTYPE_ERRORS="代付类型不合法";
	public static final String RETURN_DEPOSIT_SUPER_LIMIT="406";
	public static final String RETURN_DEPOSIT_SUPER_LIMITS="超级网银限额5万";




	public static final String RETURN_DEPOSIT_CODE_ERROR="500";
	public static final String RETURN_DEPOSIT_CODES_ERROR="未知错误";

	public static final String RETURN_DEPOSIT_PARAMETER_ERROR="501";
	public static final String RETURN_DEPOSIT_PARAMETER_ERRORS="系统解析参数出错";

	public static final String RETURN_DEPOSIT_TIMEOUT_ERROR="999";
	public static final String RETURN_DEPOSIT_TIMEOUT_ERRORS="网银代付超时";



	/**
	 * 交易类型
	 */
	public static final String MCHSUB_CREATE = "mchsub.create";//开设子商户账户
	public static final String MCHSUB_BIND_BANKCARD = "mchsub.bind.bankcard";//子商户账户绑定银行卡
	public static final String MCHSUB_UNBIND_BANKCARD = "mchsub.unbind.bankcard";//子商户账户解绑银行卡
	public static final String MCHSUB_BATCH_CREATE = "mchsub.batchcreate";//批量开设子商户
	public static final String MCHSUB_QUERY = "mchsub.query";//子商户账户查询
	public static final String MCHSUB_DISPATCH = "mchaccnt.dispatch";//商户分账
	public static final String MCHSUB_PAY_DISPATCH = "mchaccnt.pay.dispatch"; //商户支付记账
	public static final String MCHSUB_REFUND_DISPATCH = "mchaccnt.refund.dispatch"; //商户退款记账
	public static final String MCHSUB_OTHER_DISPATCH = "mchaccnt.other.dispatch"; //商户非支付退款类记账
	public static final String MCHSUB_WITHDRAW = "mchaccnt.withdraw";//账户提现
	public static final String MCHSUB_WITHDRAW_QUERY = "mchaccnt.withdraw.query";//提现查询
	public static final String MCHSUB_BALANCE_QUERY = "mchaccnt.balance.query";//余额查询
	public static final String MCHSUB_NOSTRO_ACCOUNT = "mchsub.bind.nostro";//往账接口

	/**
	 * 交易类型数组
	 */
	public final static String [] bizeTypes = new String[13];
	static {
		bizeTypes[0] = MCHSUB_CREATE;
		bizeTypes[1] = MCHSUB_BIND_BANKCARD;
		bizeTypes[2] = MCHSUB_UNBIND_BANKCARD;
		bizeTypes[3] = MCHSUB_BATCH_CREATE;
		bizeTypes[4] = MCHSUB_QUERY;
		bizeTypes[5] = MCHSUB_DISPATCH;
		bizeTypes[6] = MCHSUB_WITHDRAW;
		bizeTypes[7] = MCHSUB_WITHDRAW_QUERY;
		bizeTypes[8] = MCHSUB_BALANCE_QUERY;
		bizeTypes[9] = MCHSUB_NOSTRO_ACCOUNT;
		bizeTypes[10] = MCHSUB_PAY_DISPATCH;
		bizeTypes[11] = MCHSUB_REFUND_DISPATCH;
		bizeTypes[12] = MCHSUB_OTHER_DISPATCH;
	}

	/**
	 * 交易类型数组
	 */
	public final static String [] withdrawTypes = new String[3];
	static {
		withdrawTypes[0] = DEPOSIT_WITHDRAWTYPE_YM;
		withdrawTypes[1] = DEPOSIT_WITHDRAWTYPE_HOH;
		withdrawTypes[2] = DEPOSIT_WITHDRAWTYPE_SUPER;
	}


	public final static Map authenMap = new HashMap();
	static{
		authenMap.put("1001","手机号与银行预留信息不一致，不通过");
		authenMap.put("1102","证件号与银行预留信息不一致，不通过");
		authenMap.put("1103","姓名与银行卡预留信息不一致，不通过");
		authenMap.put("1104","银行卡号错误，不通过");
	}




	/**
	 *
	 * 成功码
	 */
	public static final String RETURN_DEPOSIT_SUCESS="0000";

	public static final String RETURN_DEPOSIT_FAIL="0001";

	public static class JdConstant {
		public final static String CONFIG_PATH = "jd" + File.separator + "jd";	// 京东支付配置文件路径
	}

	public static class WxConstant {
		public final static String TRADE_TYPE_APP = "APP";									// APP支付
		public final static String TRADE_TYPE_JSPAI = "JSAPI";								// 公众号支付或小程序支付
		public final static String TRADE_TYPE_NATIVE = "NATIVE";							// 原生扫码支付
		public final static String TRADE_TYPE_MWEB = "MWEB";								// H5支付

	}

	public static class IapConstant {
		public final static String CONFIG_PATH = "iap" + File.separator + "iap";		// 苹果应用内支付
	}

	public static class AlipayConstant {
		public final static String CONFIG_PATH = "alipay" + File.separator + "alipay";	// 支付宝移动支付
		public final static String TRADE_STATUS_WAIT = "WAIT_BUYER_PAY";		// 交易创建,等待买家付款
		public final static String TRADE_STATUS_CLOSED = "TRADE_CLOSED";		// 交易关闭
		public final static String TRADE_STATUS_SUCCESS = "TRADE_SUCCESS";		// 交易成功
		public final static String TRADE_STATUS_FINISHED = "TRADE_FINISHED";	// 交易成功且结束
	}

	public static final String NOTIFY_BUSI_PAY = "NOTIFY_VV_PAY_RES";
	public static final String NOTIFY_BUSI_TRANS = "NOTIFY_VV_TRANS_RES";


	public final static String PAY_CHANNEL_WX_JSAPI = "WX_JSAPI"; 				// 微信公众号支付
	public final static String PAY_CHANNEL_WX_NATIVE = "WX_NATIVE";				// 微信原生扫码支付
	public final static String PAY_CHANNEL_WX_APP = "WX_APP";					// 微信APP支付
	public final static String PAY_CHANNEL_WX_MWEB = "WX_MWEB";					// 微信H5支付
	public final static String PAY_CHANNEL_IAP = "IAP";							// 苹果应用内支付
	public final static String PAY_CHANNEL_ALIPAY_MOBILE = "ALIPAY_MOBILE";		// 支付宝移动支付
	public final static String PAY_CHANNEL_ALIPAY_PC = "ALIPAY_PC";	    		// 支付宝PC支付
	public final static String PAY_CHANNEL_ALIPAY_WAP = "ALIPAY_WAP";	    	// 支付宝WAP支付
	public final static String PAY_CHANNEL_ALIPAY_QR = "ALIPAY_QR";	    		// 支付宝当面付之扫码支付

	public final static String CHANNEL_NAME_WX = "WX"; 				// 渠道名称:微信
	public final static String CHANNEL_NAME_ALIPAY = "ALIPAY"; 		// 渠道名称:支付宝



	public final static byte PAY_STATUS_EXPIRED = -2; 	// 订单过期
	public final static byte PAY_STATUS_FAILED = -1; 	// 支付失败
	public final static byte PAY_STATUS_INIT = 0; 		// 初始态
	public final static byte PAY_STATUS_PAYING = 1; 	// 支付中
	public final static byte PAY_STATUS_SUCCESS = 2; 	// 支付成功
	public final static byte PAY_STATUS_COMPLETE = 3; 	// 业务完成

	public final static byte TRANS_STATUS_INIT = 0; 		// 初始态
	public final static byte TRANS_STATUS_TRANING = 1; 		// 转账中
	public final static byte TRANS_STATUS_SUCCESS = 2; 		// 成功
	public final static byte TRANS_STATUS_FAIL = 3; 		// 失败
	public final static byte TRANS_STATUS_COMPLETE = 4; 	// 业务完成

	public final static byte TRANS_RESULT_INIT = 0; 		// 不确认结果
	public final static byte TRANS_RESULT_REFUNDING = 1; 	// 等待手动处理
	public final static byte TRANS_RESULT_SUCCESS = 2; 		// 确认成功
	public final static byte TRANS_RESULT_FAIL = 3; 		// 确认失败

	public final static byte REFUND_STATUS_INIT = 0; 		// 初始态
	public final static byte REFUND_STATUS_REFUNDING = 1; 	// 转账中
	public final static byte REFUND_STATUS_SUCCESS = 2; 	// 成功
	public final static byte REFUND_STATUS_FAIL = 3; 		// 失败
	public final static byte REFUND_STATUS_COMPLETE = 4; 	// 业务完成

	public final static byte REFUND_RESULT_INIT = 0; 		// 不确认结果
	public final static byte REFUND_RESULT_REFUNDING = 1; 	// 等待手动处理
	public final static byte REFUND_RESULT_SUCCESS = 2; 	// 确认成功
	public final static byte REFUND_RESULT_FAIL = 3; 		// 确认失败

	public final static String MCH_NOTIFY_TYPE_PAY = "1";		// 商户通知类型:支付订单
	public final static String MCH_NOTIFY_TYPE_TRANS = "2";		// 商户通知类型:转账订单
	public final static String MCH_NOTIFY_TYPE_REFUND = "3";	// 商户通知类型:退款订单

	public final static byte MCH_NOTIFY_STATUS_NOTIFYING = 1;	// 通知中
	public final static byte MCH_NOTIFY_STATUS_SUCCESS = 2;		// 通知成功
	public final static byte MCH_NOTIFY_STATUS_FAIL = 3;		// 通知失败


	public final static String RESP_UTF8 = "UTF-8";			// 通知业务系统使用的编码

	
}
